﻿#include <iostream>
using namespace std;
//函数指针
void func(string name, int age)
{
    cout << "大家好我叫：" << name << "，今年" << age << "岁。" << endl;
}
void facfunc(string s1,int i1,void (*pf)(string , int ))
{
    cout << "有请我们的选手！" << endl;
    pf(s1, i1);
    cout << "我讲完了，谢谢大家。" << endl;
}
int main()
{
    string xingming = "三毛";
    int nianling = 30;
    facfunc(xingming, nianling, func);
    //string xingming = "三毛";
    //int nianling = 30;
    //func(xingming, nianling);
    //
    //void(*pfunc)(string, int);         //声明函数指针
    //pfunc = func;                          //对函数指针赋值，语法函数指针名 = 函数名(c++中函数名就是函数的地址)
    //pfunc(xingming, nianling);     //使用函数指针名调用,c++写法
    //(*pfunc)(xingming, nianling); // 使用函数指针名调用, c语言写法
}
